<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>登录</title>
<link rel="stylesheet" href="${request.contextPath}/res/css/reset.css" />
<script type="text/javascript" src="${request.contextPath}/res/jquery-easyui-1.3.6/jquery-1.11.1.js" ></script>
<script type="text/javascript">
function submitCheck(){
	var name = $("#userName").val();
	if(name==""){
		$("#name").focus();
		return false;
	}
	var password = $("#password").val();
	if(password==""){
		$("#password").focus();
		return false;
	}
	var yzmFlag = $("#yzmFlag").val();
	if(yzmFlag != 1){
		return checkYZM();
	}
	return true;
}

function changeYzm(){
	document.getElementById("yzmImg").src = "yzm?_" + new Date().getTime();
}

function checkYZM(){
	var yzm = $("#yzm").val();
	$.ajax({
		type:"get",
		url: "yzm/check",
		async:true,
		data:{"yzm": yzm},
		success:function(result){
			if(result.status == 1){
				$('#yzmFlag').val(1);
				return true;
			}else{
				alert(result.msg);
				$('#yzmFlag').val(-1);
			}
			return false;
		}
	});
}

function submitForm(){
	$("#form").submit();
}
</script>
<style>
	.main{
		padding: 0px 0px 20px 50px;
		width: 500px;
		margin: 0px auto;
		border: 1px solid #CCCCCC;
	}
	.main li{
		font-size: 18px;
		height: 30px;
		line-height: 30px;
		padding: 10px 0px;
	}
	.main li input{
		height: 25px;
		width: 150px;
	}
	.main li input, .main li img{
		vertical-align: middle;
	}
	.main li input[type=submit]{
		height: 30px;
		width: 245px;
		font-size: 20px;
	}
	.main li span{
		color:red;
	}
</style>
</head>
<body>
	<div class="main">
		<form id="form" action="${request.contextPath}/mgr/doLogin" method="post" onsubmit="return submitCheck();">
			<ul>
				<li>
					<span>
					${msg!}
					</span>
				</li>
				<li>
					<span>*</span>用户名称：<input type="text" id="userName" name="userName" />
				</li>
				<li>
					<span>*</span>用户密码：<input type="password" id="password" name="password" />
				</li>
				<li>
					<input type="hidden" id="yzmFlag" value="-1"/>
					<span>*</span>验证码：<input type="text" id="yzm" name="yzm" style="width: 80px;" maxlength="4" onblur="checkYZM()" />
					<img id="yzmImg" alt="yzm" src="${request.contextPath}/mgr/yzm" onclick="changeYzm()" style="cursor: pointer;" />
				</li>
				<li>
					<input type="button" onclick="submitForm()" value="登录" />
				</li>
			</ul>
		</form>
	</div>
</body>
</html>
